4 ifs is a pile of cyclomatic complexity, is there a way we can reduce it?