Work code into require and backbone patterns

Still messy, but getting there