Threads view count and cleanup

Cleaned up some of the code in the threads/index.js file. The new code
is more functional and allows for chaining.

View count has been implemented for threads but still need more work
once thread.create has been written and the import method can handle
view counts on import.