Refactored alignment method