Cleanup code to use latest features, and some shortcuts