resolves issue #188

By porting code from iOS