cleaned up a bit, added shell for parallel routine