Updated with Unit Tests