documetnation and cleanup of python script