Created API Flatten call
Minor formatting
Created testing framework for frame operation
Added new flattening test case from website
Multiple bug-fixes. All tests pass now except test 21