Small improvments thanks to help from @zaufi