Reoganising code layout
Identified areas to consider refactoring
Merge from github pull