structure changes and unit tests added