simplify code

fixes #3