add comment, formatting
replace magic numbers with enums and constants
clarify code