Removed some redundant legacy code, cleaned up comments