Separated functions

Functions and usage example are now in separate files