Get rid of non-struct-friendly functions, clean up a little