optimize for performance; add comparison