Moved script into separate file