made an attempt at merging dr. desoto's code

also changed some more stuff... yeah...