Refactor to async handler