functionality mostly complete