clean up and get ifs working