Cleaned up hierarchy, added encoder/decoder