Moving some functions around, preparing to deploy on EC2