changed value of top to -1