- fix issues
- simplify switch statement