Merged with jcanadas latest changes