Removed unused functions, added comments