Made use repository and removed unnessesary code