main funtion