Modularizing

@prabhasp please verify