refactor ifs back into methods