Modularized the stuff more