logging added and refined model