Slightly simplified main processing loops