added code and data structures