Moved converting to ORM from script to module