first rest, after basic bashisms scrub and improved dep checking