Moving functionality to plugin; cleanup functions.php