streamlined main def