refactored with yan and dan