add node_modules to gitignore
move some functions to another file
make code more readable