Added more testing
Optimized and fixed linking and outputting