working version with no deleted stuff