Restructered code
More code restructering and code style improvements
Various code updates