Clean and update build output more intelligently

Fixes #183.
no toLowerCase for now please - lets do it in a separate commit