fixed lint errors
fixed typo
added getPrevious functionality