some cleanups and ES5 usage