Added strict mode and cleaned up as necessary.