added handling when timeout is sleeped and basic ajax