Added xFunctions

Also brought across SQL and will update later