Refactored code.
Added missing export code to export model as Collada file.