restructure the code of Skip and Take functions