Commented and fixed code for plots