Updated from 0.5.0 branch