Functions implementation and documentation