Code rewrite

did a lot of code rewriting. Started adding copyrights and merging
different local repos and tests