general refactor and code cleaning - step three