enabled strict mode and did small refactoring