Refactoring mksamelink.cpp