Merge staging branch

Contains #521, #522, #524, #525, #527 and #528.