add functionality and tests