changed data into Enums and fixed conditions