Adds a testbed command line app and fixes some bugs with functions.