refactoring and removed unused js