Fixed infinite loop, plot now functions perfectly