removed comment
Corrected type conversions
fixing the enum
Moved a fuction and corrected the type of an array ref