added some logic to get usernames for frotnend