Cleaned up and removed some unecessary code.