converted to promises
wrote more tests