Start work on -g function
Removed some useless lines