first complete version of LBA functions