Removed some cruft and some magic numbers