fixed switch statement, other debug stuff thrown in too