there has to be a better way to do this. Switch/case would be the obvious improvement but there is probably a library (Diogo mentioned flags?) to do some of this for you