This whole section feels hacky. Is there a better approach?