fix code, add complete test of default functionality