removed unnessary code
made methods of head return values
head code optimised
mthods of tail now returns value
removed unnessary code and changed for loop