main functions completed