added some code for simple case