Added license, added size method and optimised flatten slightly.