refactored code + reflections