Cleaned up some code