Cleaned the code a bit.