more abstraction and optimization