Added smooth animation switch, fixed some bugs