adding keep alive functionality