w/o using push and pop