moved get_values_from_stack to subroutine