fixed undefined variable
add functions homework