Fix #19, #17, #11, #10
Fix merge conflicts