merging @somlor s changes into solution