Started cleanup and removed magic numbers