Adding functionality and tests