Added support for creating a stack.  Also cleaned up/improved other APIs.