Added an active frame and fixed some bugs