Fixed all unit tests and applied code review recommendations