fixes #3021 - introduce named constants

Introduced named constants and reduced amount of handlers.