removed use of lodash last() method