Some details here were suggested by @vifon