First cut implmentation done.

1. Make code more modular.
2. Obtain plots.