Holy nested ifs.