Updated header structure, bug fixes