Did a bit of cleaning up and fine-grained refactoring in plot tool.

Signed-off-by: Jakob Brandsborg Ehmsen <jakobehmsen.github@gmail.com>