move machine-class-related code to its own module