improve caption functionality