Cleaned up code a little bit