commit 13: rewriten pop function and its testcases(improved)