Add API for accessing commands, fixes #48