Added code for automatic rotational and lateral alignment to targets