Minor bug fixes/reorganization
Minor bug fixes/reorganization