Main code, with functions in separate file