Clean and update build output more intelligently

Fixes #183.
i would do this via a separate method because its a singleton