Cleaned up most of the magic numbers