Cleaned the code up