Updated code and licence