for NAN fixes
some optimisations
new method to get more control over the setFrame operations