Changed Ifs to case select