Added dependencies as arguments to anonymous function
Changed syntax for readablity and performance