working on pseudo-code for writeup