Initial version of autonomous code (INCOMPLETE).