corrected functions adding to stack