adding functionality and tests