Add two forgotten break statements
Remove older code + some refactoring