Few updates to the alignment code. 

see commit comments