added genCode