completed stack array-based implementation.
novas modificacoes.