Code refactoring to remove compleixty and unused methods