Got rid of most magic numbers, replaced with constants.