Final version of code which is starting point for major design