Added chord encoding and some corresponding tests