plots work, refactored