Improved input sanitisation and code comments and correct indentation in view code