ported rest to kotlin