Fixed arithmetic error, and made enums more clear - should also clear a warning on particular C++ compilers (according to stackoverflow)