factory.py: rewrite logging and communicate logic