refactor before helper