Categorical Structure of Dynamical Systems