moved some code out to shrc