First part of algorithm. Missing functions for transforming notes