Commited after combination of #47 and #106