Resolve more JSHint issues, fix several bugs, improve Travis build