refactored, removed unnessecary and unused code