Refactors, fixes