added missing documentation and checks for null values