Cleaned up code.
Fixed plotting code.