Enclosed subclass declarations in if blocks so that it helps prevent redeclaring errors.