Updated with latest code changes