More function cleanup