Merge of hatebourne's stuff