Moved state class to template