Could this be done a little more programmatically instead of all the the if blocks?