Some additions to get it working better.