Adding self-executing function and type checks to support client-side use