Add log out function and re-organize the files