reduced code in main script