A bit of refactor