Small efficiency fixes