changed code to use ternary op, cleaned out comments