code tidy with objects