cleaned up code, removed unnecessary functions