I think this fixes the issues and cleans up temp code, should be ready to merge now