performance + refactor