Fixed indentation
Added ping handling