reformat the code
remove unused constants and categorize others