edit forgotten line last commit. bug fix
refactor if to switch