Improve the logics