fix orders fn, add writes util