use Stack module instead of own mutable list