errorLogs added and code refactoring