updated to a working version