Changed organisation of the code.