added todo-factory.js, refactored code of index.js and tests and filenames