Transformed the machine handler into a regular middleware module