Added file output and made max_alpha a little more automatic