generic, environment-aware cleanDb task and minor build improvements