Nearest notes fixed and some other bugs