Fixed Bartek's problem

Added some brackets to make more localized vairables.