a whole lot of code cleaning and better segmenting into smaller and more sensible functions, more and better local variables