modified and clean code