Code clean up.
Added API.