moving code from manning repo