Added more helpful logging and fixed the functiontable.