Merged changes from rewrite-rioforce branch