Finalized.
Have to optimize more.