Misc. bug fixes & restructuring.
25 files changed