Cleaned the code a bit up