type checher refactoring: default case check added