improved file parsing