Add constants and remove dead code