greatly simplified external force vector and improve code formatting