Added "use strict" and many improvements