only calculate the klass once