Modularize

ok this should work now.

tested and works