Fully functional code, Needs refractoring