Fleshed out algorithm, ray state, etc.