Refactor into a proper Behat extension