Cleaned up code a little