Adding complete implementation including unit tests