loops instead of multiple if's