modularizing and simplifying