Changes/Edits to Code - Many thanks to Jwood