Created a better codec class (more Python-like), and fixed some variable names