finished main code, wrote tests, and started encoding