Authentication more robust to allow multiple functions. Date bug fixed