Deployment setup for scaler

This patch includes some code rearrangement.