code for BJMEMC