refactored a couple of utility functions
Added documentation to multiple Api-functions