Add remember window position support.
Remove unnecessary code.
Use sleep instead of ping.