Incorporate some changes from vortis