Upgrade packages
General refactor