rewrite to work with twosheds master