Some internal details updated.
Basic functions implemented.