replaced function composition with OOP-style methods