move theta definition from argument to inside of the function