Implemented @fabpot's comments