implement ping response and some other cleaning