Refactor physics system.