clean and add more coments
cache all constants to reduce the cost of lookup