Add modularization to plotting