Refactored.
Improved stack operation.