Added some extra functions and SQL doc (skeleton only)