this seems a bit racy? Is there a better approach?