lots of ifs to cwitch staments, easier to read