demo refactored