cleaned up code ready for more file analysis