Refacotred file meta data into it's own c file

Please review ;)