added profile code.  write still in progress.