Bug correction and use of lodash