simplify code

Is it the right way to send pull requests? I can try to PR a separate repo if it would be more convenient.

The GDX version is awesome btw, thanks a lot.:)