Could you fix indentation for this code. There are too many spaces for it. Also content of the IF statements if very similar. Maybe you could just change a small portion of code in the if statement and then apply it in one line. See my comments below. Try to write as minimal code as possible (less copy-paste) this way you will decrease a chance of error in the code as well as make it easier to maintain or to change later on.