Some refactoring ('use strict' added) and other small fixes