Put loose code in it's own function