Cleaned the code up a bit more