Cleaned up code a bit more