Refactored alignment package. Also refactored tests for alignment, and a bit of refactoring for metric tests.