removed unnesseccary code, fixed a few functions