Refactoring and removing unnecessary things