this function is too complicated and not needed