Set up facebook authentication and refactor code structure