Clean-up and fixes