Replaced magic numbers with constants, fixed 0xfeff (was 0xffff)