adding doc to functions - these could prob be removed after some simplification/refactoring