simplified main controller code