Added support for stacks and single file