Cleaned the code a little bit