friendslist is now encapsulated object
only fires when logged in
listener now declared in javascript

some functions have become generic functions and pushed outside object