Clean up code in script