Improving the IP script to extract features smarter. Also added a test function for validating model.