Moved function from includes to sqlactor, added some stuff to base_setup.sql