Added logging and query checking to createRoles