It'd be better to reuse existing delete_last() function for this.