First attempt at generating ar file manually.
Slightly refactored and commented.