Finalize case classes, seal traits, and turn traits into classes

General code clean up and optimization.

Finalizing case classes, sealing trait, and turning traits into classes leads to better compiled code (optimized construction and invocation) and better error messages.