Clean up and unit tests added