Changes: Bug-fixes and code optimisation.