simplified functions in main