Partial refactorization.
Replaced arrays with variables; added ull to lits to allow 64 bit operation.
Removed concept of "wire".