modified isValidOperation

Signed-off-by: Sanjay Madnani <http://sanjaymadnani.wordpress.com/>