Separated search

- No more combined searching
- Added REST functions in rest.js file
- More error logging
- Fixed indention
- Added copyright on top of .js files
Could you rewrite this so you don't need to define the same function twice? It doesn't look like the things happening in the `if` clause are are much different from what's happening in the `else`. You can probably run `_.each` on data and check its length to return `values.join(...)` later to prevent duplication.