Refactoring code, some updates to structure.