Added flatMap function, tests and README.