fixed header, added switch statement