modified bash && to if-then-fi to allow for non-bash environments