added reduction algorithm + some beta stuff that's really broken