move code out of init, fixes #80