Split code up for later javascript