Core and util
Pretty close to the final version