Recontructuring the codes and making it more objectoriented. It wont
compile right now.
Merge remote-tracking branch 'origin/master'