added -g feature