Move code from res_features into (new file) main/features.c