Removed some unused code and did some cleanup