Needs more specs for sure. Especially edge cases.
* This infrastructure, especially the rake tasks should be gemified at some point in the future. I copied exactly the same bytes many times in the last month.