added tests, prettier API