changed code to better version.