Main part of code written.