split core part as the shell_ping library, and a lot code cleanup