Functions cleanup

Added roots based cleanup
Added roots rewrites
Cleaned up Functions.php