Added declaredClass + some minor simplification.