Report problems and refactoring to allow calling function to remove element