Rebuilt friend system and lots of refactoring