Modified for better Python coding