Fix minor issues + Add tests