code for Advanced