Added implementation of Stack and fixed compile errors