Deprecation warnings

added deprecation warning when building
replaced '$i' with more meaningful variable names