added more definitions and data structures