Code

included patch from Jonathan Fors