fixed some errors. got component plots working.
updated function so it actually works!