Some minor refactors I did while investigating another issue. Functionalily should be pretty much the same as before. Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: Lauris BH <lauris@nix.lv>