Implement better codeactions introduced in this pr and take in to account comment written by @KostkaBrukowa.