improve implementation of grLines