Majore refactor. Convert to appnet.js and promises.
Update appnet library.