refactored index.js, got rid of anonimous function