avoid creating buffer on every read
added result/error constants, use constants where possible, determine type from destination address and switched to enum
nicer member name,
made constants static
Merge branch 'john30-master'