Updated versions of the modularised versions. Now working correctly.