Change data structures

Use `container/list` rather than home-spun Stack implementation.

Also added linting of code and minor rename of variable.