better version of code