Fixed procedure for !g