Cleaned up the mess a bit