Removed debugging code, fixed switch condition