refining the undefined ifs :)