Changed to new API, updated tests and README.md