remove nested function. Fixes #11