Refactor return and test data types for stack impl.