Latest update with improved code