Cleanup

Based on some feedback, cleaned up the code a little.