functions
Merging fb changes plus socketio changes