Change Function into inline for performance