Added return value to checkDir(), shaved some code.