refactored code. create Jigsaw class.