added simple main and inserstion of free calls for temporary objects