Added doxygen documentation, patching functions