changed to case from if