Changes: bug-fixes and code optimisation.