finished main framework