Moving just a few functions out of the mains script