Renamed vars and types for clarity; minor stuff; enum prefix