More refactoring and cleanup

cleanup, refactoring, fixed typos, and changed the assembly mechanism.