architecture improvement + unit tests