Refactored using Reflection.