Preliminary Bug Algorithm Code