Some code issues

- removed unused variables
- superfluous var declaration
- missing return value
- duplicated case