Restored some stuff that I removed by mistake, and improved extension.