First pass modular pattern.

still feels messy so need to break it down further to make more
readable.