Made relevant functions friend/static