Added more structures, code cleanup