added better error handling and dynamic generation of feature types list