Added Stefan's refactor