main script version 2