working prototype - needs flags