removed unnessecary functions and rewrote small non-essential bits of code