added save functionality
fixed indents
implemented tracing