improve performance, and reduce lines of code