Move script into a lib folder for neatness