mostly complete, test works