seperate stack functions to new class