Second attempt, should be merge-able now

#37, #39