Some tidying up, and changing of hard-coded values to variables.