how to create cutom library function