improved the references handling by store in separate file along the optimized file