changed method for creating stack