Added tests. Addressed code review feedback.