add conversion code and fix indentation