Updated version of MemberScript #41. This version is more reliable and works with profile forms as well.