minor changes, working version