Remove the main logic and leave only the function to be imported into other scripts