added cookies and fixed login stuff