Correct use of Q promises
Client-side TOC compilation + Code cleanup + Fix promise misuse
No additional compilation required for TOC generation