remove an un-used function
condense the ifs