Move utility functions to an own file.
Move comments for functions to its docstrings.