Changed cookies to sessions plus other fixes