Remove obsolete code and refactor constant