copied main to max