Your second and third subroutines have the same name. You can't do that.You will need to combine the code from these two into one subroutine.