Global refactoring & gems upgrade WIP