Add front end for mode
Add mode choosing backend and fix bug