Restructured and prepared for facebook authentication