share create membership function & move compiling errors into a separate function