Made a few key changes to ternary operator function that I had forgotten to add before last commit.