added d03 functions and d04 data structures