added tests and removed console.log