xuanloc implemented task #2, task #3, task #4