Implementet main functions.
Added example.