Closes #18, #17, #16 and #15.