Gerneral refactors and updates