Removed unused functions, cleanup