Added seek bar and rearranged code