Cleaned up the code some more