Fixed missing ')'
Updated with refactored code