renamed, cleaned up code
reorganized code, added a default to the switch