restructured the code and added persistence for notes