Demo code successfully refactored to use api.c! (Compiled, but not tested.)