added clean bash function and some cleanup