How do you know the conditions are not met? Print out the values of the interesting conditions before you start the if blocks. This will help with debugging.

I agree with jps - without code...