cleaned up, lines reduced with built-in mathematica symbols