Added more functionality and tests