Switched to case from if