elegant solution to remove element