einaros: if you want a refactor, I can totally do a pull request for you