use enums and minor code formatting