Remove old code, and improvement of new code, with some data validation