correct usage of shift and unshift