better version, still needs to be tinkered with