improve tests and file implementation code