refactor for more performance