Engine or motor?

The definition I go by is that an engine produces energy from within such as burning fuel in a closed area. A motor uses external energy such as electricity. Now a steam engine can be hard to classify because the energy source (heat) is on the outside but the energy produced (steam) is on the inside. Both terms can be used for the same item since both a motor and an engine take energy and produce rotational motion. I also think an engine can fall under the definition of a motor more than a motor can be defined as an engine. Just my thoughts on the subject.

I don't buy that, because gasoline, diesel, or other fuel has potential energy, and thus, internal combustion engines are also motors.