Abstracted weighted stack.

Push function should be functional.
Abstracted popping