Stack and map implementation