finalized algorithm and built-in parameters (hopefully)