Try moving business logic to functions.php. Not too successful.