added some braces and semicolons
- refactored the search state in main.js
- also some other changes (to be reviewed)