added constant values, cleaned up some code