#54. not complete.
Solution of #54. Need to refactor. Lots of duplications.