Uncommented shanes algorithm shit