Clean and update build output more intelligently

Fixes #183.
this is weird - what is going on here?