Improvement and was added logic into main class