Refactoring and removed unnecesary imports