Moved class methods into instance methods. increaded performance by moving to block callbacks and removing inner loop if then to pointer to functions.