Fixed memory leak, made initial setup for decode faster, and fixed incorectly named structures that were confusing.