Fixed preprocessing and improved plotting