Moved clientcode insertion to after the tables it depends on