Got it pretty much working