Adding functools wrapper to preserve function metadata.