Cleaned up some code, removed unused functionality.