sorting, formatting, general update of functions.php

probably more cleanup to come soon