formatting, working version