Replaced a lot of numbers with defines, mainly to make sure buffer overruns are reduced.