Added an crude active frame, fixed a lot of bugs