added partial code of local and global