Adding minstack implementation