Further improve try-to-decode code and improve undefined-length support.
Style.
Split DOM-related code in a different file.
JSHint (and remove unused stuff that conflicts with it).