Add file write, fix physics