Better use of enums, static variables, cleaned up code