optimize logic, update CHANGELOG and bump version to 0.1.2