cleanup: submit function
bugfix: multiple reference and flow errors fixed