Some tools for the direct solution of optimal control problems