updated and now working