solves displacement problem