Modularized code some more