needless code
more const is better
replaced boolean with enum
code cleanup, added explicit where neccecary