started to move some code to plugins