Move facebook code to class