write tests and fix rewrite issues
fix ordnialize function