Adding struct support and bugs fixes