Refactored various functions after noticing new warnings when compiling on Apple DTK devices - there should now be fewer warnings when building.