fix ui animations and add median detection