functions nearly complete