Move main script to external file