Simplified the code and consts.