refactoring / framesleep