implemented correct functionality