Refactored a little more to clean up repetitive code.