Refactor of the code and add chords