Add remember window position support.
Remove unnecessary code.
Use sleep instead of ping.
Merge pull request #90 from zlsun/master

Some modifications.