Solidifying code even further by refactoring similar code into a function.
Need to get the whole path thingie working -- last bit before feature is complete!