updated to aaron's patches