Tidied up and removed magic numbers