Refactored trim_align.py into separated files

All tests pass.