update remove function and remove unused code in utils.js