forgot to close dir whoopzzzzzz
Cleaned up main and moved functions to own source file, implemented count_files and populate_bmp_info, need to rewrite calc_optimal based on new implementations