Refactored plot