Streamline main function