added size conditionals to functions