Rearranged functions for more viewing pleasure.