Fix up build flags.
Re-work the whole stack implementation.
Refactor main to use the new API.
Update README.