Cleaned up code. Added switch for local and production deploy.