Merge of @lewurm's PR and update to Truffle 0.5