removed stack implementation, used simple counter