added logic for fetching stacks, adding stacks