This is getting a bit complicated. Can we break this into multiple ifs + returns or something like that?