Changed implementation of the convert method