solves issue #23

Moved variables that are 'constant' before plugin func to evaluate them
only once and always before they are used