Refactoring Stack class.
Changing conditional operations.