Initial attempt at cleaining up shell functions