With suggestions from @Aristona  and @gcphost