More structure and quick bug fixes