Machine learning functional. Cleaning up front end