refactored facebook code into own class