updates+improvements

updates by me
improvements from dragonpt source