General refactors and updates