Clean and update build output more intelligently

Fixes #183.
Merge pull request #184 from palantir/fix-183

Clean and update build output more intelligently