More improvements to functions