Fixes #72 Rewrite main binary a bit