Minor changes / refactoring - some variables are renamed