Restructured automark code into a class