Data preprocessing and visualization functions for