code for 3.1