Developed code for q method, fixed ICI bug