all this logic is basically copied from autoplace… which is not ok