First version of main script