refactoring started with separate index/js
refactoring