... and a docblock would help, this code isn't particularly self explanatory