Updated to add unit tests