finish off most of the functionality