improves library functions, adds tests
improves README