Rake cleanup

A few general improvements to the rake tasks, and some specific improvements on #299.