bug fixes, moved packages and unit tests, more to follow

Change-Id: Ibf7203cab2098e9d8e0e79e613d612507057c716