updated code, tests and README