Refactored boxing and unboxing delegates.