Fixed main script