added friends tab, cleaned up code