Added scaling function. No memory leak issues (except for the tiny one). Still got SaveFrame saved frame misalignment problem.