added assignment02 encoder functionality and it works