Added changes to branch issue13 and removed unnessecary code.