Fixed review comments, added junit cases