code cleanup and fixed issue where route reloaded before cookies were deleted