Extracted structures to seperate header file and fixed some bugs.