added directories, added chain routines