adding createMain function