Add asynchronous api and change command to actually register a command