Expanded bashbang function to be general use