add trace functions and mistakes are made