pulled code out to .rb