Extended test.js to include more tests and refactored functions to make more testable