Sanitising input and minor small fixes to profile