Updated with latest code