Fix ref navigation bug; make internal command line work; cleanups