Correct bugs and add a new condition
Add new functions