Add type synonyms

Also move some functions around.