refactored plotting code
updated render