Finalized code and plots