Got it working, now just need to cleanup some minor bugs