implemented frame size fix + a ton of code clean up