Move code into module