general refactor and code cleaning - step one