code to check alignment