I refactored the inside check into a loop. This likely made things more complicated looking...not really sure if it was a better choice.