Membership re-done using API classes and secure queries