Structure code, still a little buggy